package io.gitee.vexlife.snake;

public class GameHost implements Runnable {
	private GameController gmctrl;

	public GameHost(GameController gmctrl) {
		this.gmctrl = gmctrl;
	}

	@Override
	public void run() {
		while (true) {
			if (!gmctrl.isOver()) {
				new Thread(new GameActivityPerformer(this.gmctrl)).start();
			}else {
				return;
			}
			try {
				Thread.sleep(this.gmctrl.getGameInterval());
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
}
